#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 500002;

int n,m;
struct Node{
    LL sum,lazy;
    Node():lazy{0}{}
    Node(LL sum_,LL lazy_):sum{sum_},lazy{lazy_}{}
};
Node tree[4*N];
LL arr[N];

void build(int idx,int l,int r){
    if(l==r){
        tree[idx].sum = arr[l];
        return;
    }
    int mid = (r-l)/2+l;
    build(2*idx,l,mid);
    build(2*idx+1,mid+1,r);
    tree[idx].sum = tree[2*idx].sum + tree[2*idx+1].sum;
}
void push_down(int idx,int l,int r){
    int mid = (r-l)/2+l;
    if(tree[idx].lazy){
        tree[2*idx].lazy += tree[idx].lazy;
        tree[2*idx+1].lazy += tree[idx].lazy;
        tree[2*idx].sum += tree[idx].lazy*(mid-l+1);
        tree[2*idx+1].sum += tree[idx].lazy*(r-mid);
        tree[idx].lazy = 0;
    }
    return;
}
void add(int idx,int l,int r,const int L,const int R,const LL v){
    if(l>R||r<L) return;
    if(L<=l&&r<=R){
        tree[idx].sum += v*(r-l+1);
        tree[idx].lazy += v;
        return;
    }
    int mid = (r-l)/2+l;
    push_down(idx,l,r);
    add(2*idx,l,mid,L,R,v);
    add(2*idx+1,mid+1,r,L,R,v);
    tree[idx].sum = tree[2*idx].sum + tree[2*idx+1].sum;
}

LL qans = 0;
void query(int idx,int l,int r,const int pos){
    if(l>pos||r<pos) return;
    if(l==r){
        qans = tree[idx].sum;
        return;
    }
    push_down(idx,l,r);
    int mid = (r-l)/2+l;
    query(2*idx,l,mid,pos);
    query(2*idx+1,mid+1,r,pos);
}

int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)  scanf("%lld",&arr[i]);
    build(1,1,n);
    int x,y,op;
    LL k;
    // for(int i=1;i<=n;i++){
    //     query(1,1,n,i);
    //     cout<<qans<<' ';
    // }
    // cout<<endl;

    for(int i=1;i<=m;i++){
        scanf("%d",&op);
        //[x,y] +k
        if(op==1){
            scanf("%d%d%lld",&x,&y,&k);
            add(1,1,n,x,y,k);
        }
        //arr[x]
        else if(op==2){
            scanf("%d",&x);
            query(1,1,n,x);
            printf("%lld\n",qans);
        }
        // for(int i=1;i<=n;i++){
        //     query(1,1,n,i);
        //     cout<<qans<<' ';
        // }
        // cout<<endl;
    }
}